home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The X-Philes (2nd Revision)
/
The X-Philes Number 1 (1995).iso
/
xphiles
/
hp48_1
/
alg_jl
< prev
next >
Wrap
Internet Message Format
|
1995-03-31
|
4KB
From: John Latala <jrl@images1.waterloo.NCR.COM>
Subject: v05i021: alg_jl - Algebraic/prefix/rpn conversions v1.0, Part01/01
Newsgroups: comp.sources.hp48
Organization: Imaging Systems Division, NCR Corporation, Waterloo, Ont., CANADA
Followup-To: comp.sys.hp48
Approved: spell@seq.uncwil.edu
Checksum: 447259064 (verify with brik -cv)
Submitted-by: john Latala <jrl@images1.waterloo.NCR.COM>
Posting-number: Volume 5, Issue 21
Archive-name: alg_jl/part01
BEGIN_DOC alg.doc
Below is a directory of routines for converting between algebraic
expressions, PREFIX lists or RPN lists.
A PREFIX list is similar to a parse tree. Shown below are all three
forms for the same expression:
Name Type Example
---- ---- -------
algebraic A 'A*(B+C)'
prefix list P { * A { + B C } }
rpn list R { A B C + * }
The directory has routines for going from any source A/P/R to any
different destination A/P/R
The algebraic expressions shouldn't use the variable names 'n', 'op',
'i' or 'l' because they are variables local to some of the routines.
END_DOC
BEGIN_RPL alg.rpl
%%HP: T(3)A(D)F(.);
DIR
A\->P
\<<
OBJ\-> SWAP
\-> n
\<<
n 1 + ROLLD
1 n
START n
ROLL
IF DUP TYPE 9 == THEN
IF DUP SIZE 1 \=/ THEN
A\->P
END
END
NEXT
n 1 + \->LIST
\>>
\>>
A\->R
\<<
A\->P P\->R
\>>
P\->A
\<<
IF DUP TYPE 5 == THEN
OBJ\-> 1 -
\-> n
\<<
1 n
START n
ROLL P\->A
NEXT
n 1 + ROLL EVAL
\>>
END
\>>
P\->R
\<<
IF DUP TYPE 5 == THEN
OBJ\-> 1 - DUP 2 + ROLL
\-> n op
\<<
{ }
n 1
FOR i
i 1 + ROLL P\->R + -1
STEP
op +
\>>
ELSE
1 \->LIST
END
\>>
R\->A
\<<
\-> l
\<<
1 l SIZE
FOR i
'l' i GET EVAL
NEXT
\>>
\>>
R\->P
\<<
R\->A A\->P
\>>
END
END_RPL
BEGIN_ASC alg.asc
%%HP: ;
"69A20FF7BE200000003025D80530D9D20E163284E203025D81484E203014D805
93632B2130830003025D81430D9D20E16321C432D6E2010C6E16329C2A2D6E20
10C68B9C10A132D6E20109645632D6E2010C697632D6E2010966C7D1EB3A1C42
32EF53293632B2130280003005D82530D9D20E16323CE2278BF168BC1D13A227
9E1AFE22D9D20B7FC19C2A290DA178BF1ED2A276BA15BCF11C432D6E2010E6D6
E2020F607E163247A20B2130D6E2010E69C2A20A132D6E201096D6E2010969C2
A276BA15BCF184E203005D82576BA1683A208332D6E2020F60776BA1EF532B21
305BF22D9D209C2A2387C1B21305DF2293632B2130411003005D81430D9D20E1
6323CE2278BF168BC1D13A2279E1AFE22D9D20B7FC19C2A290DA11C432D6E201
0E6E16329C2A2D6E2010E630132D6E2010E65BCF184E203005D814C4232D6E20
10E69C2A276BA15BCF1EB3A1EF532B21305DF2293632B21302C0003014D82530
D9D20E163284E203014D80584E203005D82593632B2130830003014D80530D9D
20E1632B7FC1DBBF11C432D6E2010E6E1632D6E2010E69C2A276BA10DCF19C2A
2D6E2010E630132D6E2010E65BCF13CE2278BF168BC1173A2279E1AFE22D9D20
3CE2278BF18B9C19C2A2D9AE1AFE2284E203014D8055DF22B21305DF22C4232D
6E2010E69C2A276BA1387C1EF53293632B2130008A"
END_ASC
BYTES: #A800h 506.5
BEGIN_UU alg.uue
begin 644 alg
M2%!(4#0X+466*O!_ZP(````#4HU0`YTMX&$C2"XP(-48A.0"`T&-4#DVLA(#
M.``P(-48--#9`AXV$DPC;2X0P.9A(\FBTN8"`6RXR0$:(VTN$)!&92-M+A#`
MEF<C;2X0D&9\';ZCP20C_C628R,K,2`(``-0C5(#G2W@82/#+G*X'X;+T3$J
M<NFA[R*=+;#W',FBDM`:A_OA+2IGJU'+'\$TTN8"`6YM+B#P!N=A(W0JL!(#
M;2X0X)8L*J`QTN8"`6EM+A"0EBPJ9ZM1RQ](+C``U2AUMAJ&HP(X(VTN(/`&
M=[8:_C6R$@.U+]+9`LFB,G@<*S%0_2(Y-K(2`Q0!,`#5V0(>-C+L(H?[
M8;@<':,BEQ[Z+M+9`GO/D2PJ":T13"-M+A#@YF$CR:+2Y@(!;@,QTN8"`6ZU
M_('D`@-0C4%,,M+F`@%NR:)RMAJU_.$[&OXULA(#U2^28R,K,2`,``-!C5(#
MG2W@82-(+C`0U`B%Y`(#4(U2.3:R$@,X`#`0U`@UT-D"'C:R]QR]^Q%,(VTN
M$.#F82-M+A#@EBPJ9ZL!S1_)HM+F`@%N`S'2Y@(!;K7\,>PBA_MAN!QQHR*7
M'OHNTMD"PRYRN!^XR9$L*IWJH>\B2"XP$-0(5?TB*S%0_2),,M+F`@%NR:)R
,MAJ#Q^%?(SDVLA(#
`
end
sum -r/size 52635/720 section (from "begin" to "end")
sum -r/size 9883/507 entire input file
END_UU
--
john.Latala@Waterloo.NCR.COM
SYSTEM-E-ARMAGEDDON, WORLD quanta expired. System being shutdown.
SYSTEM-I-ARMAGEDDON, Have a nice day.